package com.zhentao.controller;


import com.zhentao.file.server.FileStorageService;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("image")
public class ImageController {
    @Autowired
    FileStorageService fileStorageService;

    @SneakyThrows
    @RequestMapping("image")
    public String image( MultipartFile file){
        System.err.println(file);
        String url = fileStorageService.uploadHtmlImage(file.getOriginalFilename(), file.getInputStream());
        return url;
    }
}
